using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Steamrunner
{
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        ScreenManager screenManager = null;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            Window.Title = "Steamrunner";

            graphics.PreferredBackBufferHeight = 900;
            graphics.PreferredBackBufferWidth = 1600;
            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            screenManager = new ScreenManager(this);
            screenManager.Initialize();
            screenManager.AddScreen("PlayScreen", new PlayScreen(screenManager, this));
            screenManager.AddScreen("MenuScreen", new MenuScreen(screenManager, this));
            screenManager.AddScreen("OptionsScreen", new OptionsScreen(screenManager, this));
            screenManager.AddScreen("HighscoreScreen", new HighscoreScreen(screenManager, this));
            screenManager.AddScreen("CreditsScreen", new CreditsScreen(screenManager, this));
            screenManager.AddScreen("GameOverScreen", new GameOverScreen(screenManager, this));
            screenManager.AddScreen("HowToPlayScreen", new HowToPlayScreen(screenManager, this));
            screenManager.AddScreen("PlayerSelectScreen", new PlayerSelectScreen(screenManager, this));
            
            screenManager.CurrentScreen = "MenuScreen";

            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
        }

        protected override void UnloadContent()
        {
        }

        protected override void Update(GameTime gameTime)
        {
            screenManager.Update(gameTime);

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Orange);

            screenManager.Draw(gameTime);

            base.Draw(gameTime);
        }
    }
}
